import {CLOSE_RECORD_VIDEO, OPEN_RECORD_VIDEO, QUERY} from '../types/RecordType'

const initState = {
  recordInfoList: [],
  recordVideoVisible: false
}

const recordReducer = (state = initState, dispatch) => {
  switch (dispatch.type) {
    case QUERY: {
      return {
        ...state,
        recordInfoList: dispatch.payload
      }
    }
    case "ERROR": {
      return {
        ...state,
        err: dispatch.payload.err
      }
    }
    case CLOSE_RECORD_VIDEO: {
      return Object.assign({}, state, dispatch)
    }
    case OPEN_RECORD_VIDEO: {
      return Object.assign({}, state, dispatch)
    }
    default:
      return state
  }
}

export default recordReducer